package com.cn;

import org.flowable.engine.*;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.task.api.Task;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 创建文件方式
 */
@SpringBootTest
public class flowableTest07 {

    @Autowired
    RepositoryService repositoryService;

    @Autowired
    IdentityService identityService;

    @Autowired
    RuntimeService runtimeService;

    @Autowired
    TaskService taskService;
    @Test
    void testFlowable(){
        String procDefId = "";
        ProcessDefinition processDefinition = repositoryService
                .createProcessDefinitionQuery()
                .processDefinitionId(procDefId)
                .latestVersion().singleResult();
        if (processDefinition.isSuspended()){
            throw new RuntimeException("程序被挂起");
        }

        //设置流程发起哲
        identityService.setAuthenticatedUserId("学生");
        Map<String,Object> varialbes = new HashMap<>();
        //添加用户
        varialbes.put("test","");

        //第一个申请人进行申请给意见的方式
        String runId = "";
        runtimeService.startProcessInstanceById(runId,varialbes);
    }

}